import Vue from "vue"
import Vuex from "vuex" //引入vuex
Vue.use(Vuex) //使用vuex

export default new Vuex.Store({
    state: {
        // 搜索页面传参
        sousuoinput: '',
        ifsousuofirst: true,
        num: "",
        dingdanid: 0,
        productId: 0,
        deliverId: 0,
        // 聊天页面传参
        fromid: 0,
        toid: 0,
        toname: "",
        // 余额页面传参
        uid: 0,
        balance: 0,
        // 个人设置页面传参
        addressId: 0,
        addressName: "",
        addressTel: "",
        // 更新商品页面传参
        updatePrice: 0,
        updateGuarentee: 0,
        // 订单地址电话
        orderAdress:"",
        orderTel:"",
    },
    mutations: {
        changesousuoiffirst(state, id) {
            state.ifsousuofirst = id;
        },
        changesousuoinput(state, id) {
            state.sousuoinput = id;
        },
        changedingdanid(state, id) {
            state.dingdanid = id
        },

        changeproductid(state, id) {
            state.productId = id;
        },
        deliverId(state, id) {
            state.deliverId = id;
        },
        fromid(state, id) {
            state.fromid = id;
        },
        toid(state, id) {
            state.toid = id;
        },
        toname(state, id) {
            state.toname = id;
        },
        toBlanceId(state, uid) {
            state.uid = uid
        },
        toBlanceBalance(state, balance) {
            state.balance = balance
        },

        getAddressId(state, id) {
            state.addressId = id;
        },
        getAddressName(state, name) {

            state.addressName = name;

        },
        getAddressTel(state, tel) {
            state.addressTel = tel;
        },
        toUpdatePrice(state,updatePrice){
            state.updatePrice = updatePrice
        },
        toUpdateGuarentee(state,updateGuarentee){
            state.updateGuarentee = updateGuarentee
        },
        changeOderAdress(state,adress){
            state.orderAdress = adress
        },
        changeOrderTel(state,tel){
            state.orderTel = tel
        }
    },
    actions: {

    },
    modules: {

    }
})
